﻿using System.Globalization;
using EPiServer.Framework.DataAnnotations;

namespace OpenWaves.EPiServer.GeoProperties
{
    [TemplateDescriptor(TagString = PropertyGeoPoint.UiHint)]    
    class PropertyGeoPointControl : PropertyGeoObjectControl<GeoPoint>
    {        
        public PropertyGeoPointControl()
        {
        }        

        protected override string CreateMapUrl(GeoPoint value)
        {
            var point = this.PropertyData.Value as GeoPoint;
            if (point == null) return string.Empty;
            var googleMapApiInfo = GoogleMapsApiInfo.Default;

            return value.GetImageUrl(googleMapApiInfo.Width, googleMapApiInfo.Height);
        }
    }

    [TemplateDescriptor(TagString = PropertyGeoPoint.GeoPointViewUiHint)]
    class PropertyGeoPointViewControl: PropertyGeoPointControl
    {
        
    }
}